<?php
//开启session
session_start();
//包含数据库配置文件
include '../public/dbconfig.php';
//包含函数库文件
include '../public/functions.php';
//调用函数 链接数据库
$link = con();

//接收版块id
$cid = $_GET['cid'];
//接收主贴id
$fid = $_GET['fid'];
//接收需要关注的id
$attid = $_GET['uid'];

//准备sql
$sql = "delete from att where uid='{$_SESSION['id']}' and attid='{$attid}'";
//执行sql
$res = mysqli_query($link, $sql);
//判断执行结果
if($res){
	echo '<script>alert("取消关注成功");window.location.href="detail.php?tid='.$fid.'&cid='.$cid.'"</script>';
}else{
	echo '<script>alert("取消关注失败");window.location.href="detail.php?tid='.$fid.'&cid='.$cid.'"</script>';
}
//关闭数据库链接
mysqli_close($link);